package com.itboye.textileexpes.presenter;

import java.util.List;
import java.util.Observer;

import android.util.Log;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.textileexpes.interfaces.IGetYanZhengMa;
import com.itboye.textileexpes.repository.YanzhengmaRespository;
import com.itboye.textileexpres.base.BasePresenter;
import com.itboye.textileexpres.base.ResultEntity;

public class GetYanzhengMaPresenter extends BasePresenter implements
		IGetYanZhengMa<String> {

	public static final String YanzhengmaSuccessEvent = MainPresenter.class
			.getName() + "_Yanzhengma_success";
	public static final String YanzhengmaFailEvent = MainPresenter.class
			.getName() + "_Yanzhengma_failure";

	public GetYanzhengMaPresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	public void getYzm(String phoneNumber) {

	}

	@Override
	public void add(String model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(String model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(String model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(String model) {
		// TODO Auto-generated method stub

	}

	@Override
	public List<String> query(String model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void getVerificationCode(String phoneNumber,String country, String codeType) {
		// TODO Auto-generated method stub
		IGetYanZhengMa<String> getYanZhengMa = new YanzhengmaRespository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						Log.v("MainPresenter", "yanzeng success");
						result.setEventTag(Tag_Success);
						result.setEventType(YanzhengmaSuccessEvent);
						GetYanzhengMaPresenter.this.setChanged();
						GetYanzhengMaPresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						Log.v("MainPresenter", "yanzeng fail");
						result.setEventTag(Tag_Error);
						result.setEventType(YanzhengmaFailEvent);
						GetYanzhengMaPresenter.this.setChanged();
						GetYanzhengMaPresenter.this.notifyObservers(result);
					}
				});
		getYanZhengMa.getVerificationCode(phoneNumber,country, codeType);
	}
}
